﻿<%@ Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="FileManager.aspx.cs" Inherits="Admin.FileManager" Title="Untitled Page" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphMain" runat="server">
<telerik:RadCodeBlock ID="codeBlock1" runat="server">
<script type="text/javascript">
//<![CDATA[

function OnClientItemSelected(sender, args) {
    var pvwImage = $get("<%= pvwImage.ClientID %>");
    var imageSrc = args.get_path();

    if (imageSrc.match(/\.(gif|jpg|jpeg|png)$/gi)) {
        pvwImage.src = imageSrc;
        pvwImage.style.display = "";
        pvwImage.alt = imageSrc.substring(imageSrc.lastIndexOf('/') + 1);
    }
    else {
        pvwImage.style.display = "none";
    }
}
function toolbarClicked(toolbar, args)
{
    var buttonValue = args.get_item().get_value();
    if (buttonValue == "MultiUpload")
    {
        var oWnd = radopen("/MultiUpload.aspx?path=" + $find("<%=RadFileExplorer1.ClientID %>").get_currentDirectory(),null);
        oWnd.add_close(OnClientMultiUploadWindowClosed);
    }
}
function OnClientMultiUploadWindowClosed()
{
    $find("<%=RadFileExplorer1.ClientID %>").refresh();
}
function gridContextMenuClicked(toolbar, args)
{
    var buttonValue = args.get_item().get_value();
    if (buttonValue == "custom_Menu")
        alert("custom context menu item clicked");
}
function treeContextMenuClicked(toolbar, args)
{
    var buttonValue = args.get_menuItem().get_value();
    if (buttonValue == "custom_Menu")
        alert("custom context menu item clicked");
}
function attachHandlers(explorer, args)
{
    //support for grid context menu
    var toolbar = explorer.get_toolbar();
    toolbar.add_buttonClicked(toolbarClicked);

    //support for grid context menu
    var gridContextMenu = explorer.get_gridContextMenu();
    gridContextMenu.add_itemClicked(gridContextMenuClicked);

    //TreeView handler is attached in codebehind
}
//]]>
</script>
    </telerik:RadCodeBlock>
<telerik:RadFileExplorer ID="RadFileExplorer1" Width="660" Height="500" OnClientItemSelected="OnClientItemSelected" runat="server" OnClientLoad="attachHandlers">
<Configuration ViewPaths="~/Uploads" MaxUploadFileSize="10485760" UploadPaths="~/Uploads" DeletePaths="~/Uploads" />
</telerik:RadFileExplorer>
<telerik:RadWindow Width="200" Height="200" NavigateUrl="http://google.com.vn" Visible="false" runat="server"></telerik:RadWindow>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphSidebar" runat="server">
<!--[if !IE]>start sidebar module<![endif]-->
<div class="sidebar_module">
	<div class="title_wrapper">
		<h3>Xem trước ảnh</h3>
	</div>
	<div class="gallery">
		<!--[if !IE]>start gallery inner<![endif]-->
		<div class="gallery_inner clearfix">
		    <img id="pvwImage" src="" runat="server" alt="" class="previmage" style="display: none; max-width: 260px" />
		</div>
		<!--[if !IE]>end gallery inner<![endif]-->
	</div>
</div>
</asp:Content>
